﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace RPGGameLibrary
{
    public class CameraController:Input
    {
        public Camera Cam;
       
        public CameraController( Camera _Cam)
        {
            Cam=_Cam;
        }
        public void Update()
        {
            Vector3 CameraNewLocation = Cam.Location;
            if (Keyboard.GetState().IsKeyDown(Keys.W))
            {
             
                    CameraNewLocation += new Vector3(1, 0, 0);
                
               
            }
            if (Keyboard.GetState().IsKeyDown(Keys.S))
            {
                
                    CameraNewLocation -= new Vector3(1, 0, 0);

                
            }
            if (Keyboard.GetState().IsKeyDown(Keys.A))
            {
               
                    CameraNewLocation -= new Vector3(0, 0, 1);
                
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D))
            {
               
                    CameraNewLocation += new Vector3(0, 0, 1);
                
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Space))
            {
                


                    CameraNewLocation += new Vector3(0, 1, 0);
                
            }
            if (Keyboard.GetState().IsKeyDown(Keys.LeftControl))
            {
              CameraNewLocation -= new Vector3(0, 1, 0);
                
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
               
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Q))
            {
               
            }
            if (Keyboard.GetState().IsKeyDown(Keys.E))
            {
               
            }
            Vector3 CameraOldLocation = Cam.Location;
            
            if (Cam.collusion(CameraNewLocation))
            {
                Cam.Location = CameraOldLocation;
            }
            else
            Cam.Location = CameraNewLocation;
        }
    }
}
